import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import legacy from '@vitejs/plugin-legacy'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),
  legacy({
    targets: ['> 1%, last 1 version, ie >= 11'],
    additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
  })],

  resolve: {
    alias: {
      '@': resolve(__dirname, '.', 'src'),
    },
    // 忽略后缀名的配置选项, 添加 .vue 选项时要记得原本默认忽略的选项也要手动写入
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  },
  server: {
    open: true,
    port: 3333,
  },

  build: {
    target: 'es2015',
  },
})
